# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

pkgname=usort
pkgver=1.0.4
pkgrel=3
pkgdesc='Safe, minimal import sorting for Python projects'
arch=('any')
url='https://github.com/facebookexperimental/usort'
license=('MIT')
depends=('python-attrs' 'python-click' 'python-libcst' 'python-moreorless'
         'python-stdlibs' 'python-toml' 'python-trailrunner')
makedepends=('python-build' 'python-installer' 'python-setuptools-scm' 'python-wheel')
checkdepends=('python-volatile')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha512sums=('101af003b27824fa0ac76d824fa2b29c8e0b40e074ad299efe006c161c68812a69285c2c8b84f3961276f99782e59899c26716d7d365726966933c3584a27c7d')

build() {
  cd $pkgname-$pkgver

  SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver python -m build -nw
}

check() {
  cd $pkgname-$pkgver

  python -m usort.tests
}

package() {
  cd $pkgname-$pkgver

  python -m installer -d "$pkgdir" dist/*.whl

  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
